<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>发布</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="__PUBLIC__/assets/i/46.png">
    <link rel="stylesheet" href="__PUBLIC__/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="__PUBLIC__/assets/css/app.css">
    <link rel="stylesheet" href="__PUBLIC__/css/dici.css">
    <link rel="stylesheet" href="__PUBLIC__/css/pub.css">
</head>
<body>
    <!--内容列表-->
    <form action="__URL__/addHelpPost" method="post" enctype="multipart/form-data">
        <input name="name" id="name" placeholder="姓名" class="dc-input"/>
        <input name="phone" id="phone" placeholder="电话" class="dc-input"/>
        <input name="sex" id="sex" placeholder="性别" class="dc-input"/>
        <input name="area" id="area" placeholder="地区" class="dc-input"/>
        <input name="age" id="age" placeholder="年龄" class="dc-input"/>
        <input name="uid" id="uid" type="hidden" value="{$uid}"/>
        <hr class="dc-hr2"/>
        <div class="am-form-group am-form-file dc-div-1">
            <button type="button" class="am-btn am-btn-default am-btn-sm">
                <i class="am-icon-cloud-upload"></i> 上传照片
            </button>
            <input id="doc-form-file" type="file" name="file" multiple>
        </div>
        <div id="file-list" class="dc-div-1"></div>
        <div class="dc-div-1">
            <textarea name="intro" id="intro" rows="5" class="dc-text-area" placeholder="互助意向"></textarea>
        </div>
        <div class="dc-div-1">
        <input type="submit" id="submit" class="am-btn am-btn-success" value="提交" style="width: 90%;">
        </div>
    </form>
    <!--end-->
    <div class="dc-alert">

    </div>
    <include file="public/footer_m_nojs"/>
    <script src="__PUBLIC__/assets/js/jquery.min.js"></script>
    <script src="__PUBLIC__/assets/js/amazeui.min.js"></script>
    <script>
        $(function () {
            $('#doc-form-file').on('change', function () {
                var fileNames = '';
                $.each(this.files, function () {
                    fileNames += '<span class="am-badge">' + this.name + '</span> ';
                });
                $('#file-list').html(fileNames);
            });
            $('#submit').on('click',function(){
                if($('#name').val() ==''){
                    var data = "<div class='am-alert am-alert-danger dc-div-center-per' data-am-alert><button type='button' class='am-close'>&times;</button><p>请填写姓名</p></div>"
                    $(".dc-alert").append(data);
                    return false;
                }
                if($('#phone').val() ==''){
                    var data = "<div class='am-alert am-alert-danger dc-div-center-per' data-am-alert><button type='button' class='am-close'>&times;</button><p>请填写电话</p></div>"
                    $(".dc-alert").append(data);
                    return false;
                }
                if($('#sex').val() ==''){
                    var data = "<div class='am-alert am-alert-danger dc-div-center-per' data-am-alert><button type='button' class='am-close'>&times;</button><p>请填写性别</p></div>"
                    $(".dc-alert").append(data);
                    return false;
                }
                if($('#area').val() ==''){
                    var data = "<div class='am-alert am-alert-danger dc-div-center-per' data-am-alert><button type='button' class='am-close'>&times;</button><p>请填写地区</p></div>"
                    $(".dc-alert").append(data);
                    return false;
                }
                if($('#age').val() ==''){
                    var data = "<div class='am-alert am-alert-danger dc-div-center-per' data-am-alert><button type='button' class='am-close'>&times;</button><p>请填写年龄</p></div>"
                    $(".dc-alert").append(data);
                    return false;
                }
                if($('#intro').val() ==''){
                    var data = "<div class='am-alert am-alert-danger dc-div-center-per' data-am-alert><button type='button' class='am-close'>&times;</button><p>请填写互助意向</p></div>"
                    $(".dc-alert").append(data);
                    return false;
                }
                if($('#doc-form-file').val() ==''){
                    var data = "<div class='am-alert am-alert-danger dc-div-center-per' data-am-alert><button type='button' class='am-close'>&times;</button><p>你还没有填写商品照片</p></div>"
                    $(".dc-alert").append(data);
                    return false;
                }

            });
        });
    </script>
    </body>
</html>